﻿using Hx.Application.Configuration;
using Hx.DataTransferObject;
using Hx.Domain.Model;
using Hx.Infrastructure;
using Hx.Infrastructure.Services;

namespace Hx.Application
{
    public class HxInitializer : IInitializer
    {
        /// <summary>
        ///     应用程序启动
        /// </summary>
        public void Start()
        {
            AutoMapper.Mapper.CreateMap<Article, ArticleObject>();
            AutoMapper.Mapper.CreateMap<Category, CategoryObject>();

            foreach (ComponentConfigurationElement component in ConfigHelper.Components)
                ServiceLocator.Instance.RegisterComponent(component.Service, component.Instance);
        }

        /// <summary>
        ///     应用程序释放
        /// </summary>
        public void Dispose()
        {
        }
    }
}